<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:sg="http://java.sun.com/jsf/composite/ezcomp"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <h:outputStylesheet library="css" name="Main.css" />
        <h:outputStylesheet library="css" name="Form.css" />
        <h:outputStylesheet library="css" name="TopMenu.css" />
        <h:outputStylesheet library="css" name="Footer.css" />
        <h:outputStylesheet library="css" name="Chart.css" />
        <h:outputStylesheet library="css" name="tipsy.css" />
        <h:outputStylesheet library="css" name="jquery-ui-1.8.14.custom.css" />
        <h:outputStylesheet library="css" name="datepicker.css" />
        <h:outputStylesheet library="css" name="datePickerLayout.css" />
        <h:outputScript library="javascript" name="jquery.prettyPhoto.js" />
        <h:outputScript library="javascript" name="jQuery.js" />
        <h:outputScript library="javascript" name="jquery.tipsy.js" />
        <h:outputScript library="javascript" name="jQueryUi.js" />
        <h:outputScript library="javascript" name="jQueryUiWidget.js" />
        <h:outputScript library="javascript" name="json2.js" />
        <h:outputScript library="javascript" name="jQueryUiDatePicker.js" />
        <h:outputScript library="javascript" name="datepicker.js" />
        <h:outputScript library="javascript" name="eye.js" />
        <h:outputScript library="javascript" name="layout.js" />
        <title>Marcadores</title>
    </h:head>
    <h:body>
        <sg:pageHeader >
            <ui:param name="menu" value="true" />
        </sg:pageHeader>

        <h2>Marcadores Pessoais</h2>
        <h:form>
            <div class="frameContent">
                <div class="frameleft">
                    <h3>Lista de contratos:</h3>
                    <h:selectOneListbox styleClass="ContractList" value="#{marcadoresBackingBean.selectedContract}" title="Selecione um contrato para visualizar os respectivos marcadores">
                        <f:selectItems value="#{marcadoresBackingBean.contractList}" />
                        <f:ajax event="change" render="annotationList" />
                    </h:selectOneListbox>
                </div>

                <h:panelGroup id="annotationList" styleClass="frameright">
                    <div class="framerightVerticalLine"></div>
                    <h3>Marcadores:</h3>
                    <h:selectOneListbox onchange="cenas" styleClass="ContractList" value="#{marcadoresBackingBean.selectedAnnotation}" title="Selecione uma anotação para visualizar os seus detalhes">
                        <f:selectItems value="#{marcadoresBackingBean.annotationList}" />
                        <f:ajax event="change" render="annotationInfo" />
                    </h:selectOneListbox>
                </h:panelGroup>
            </div>

            <h:panelGroup id="annotationInfo" styleClass="frameContent">
                <div class="framecenter">
                    <h:outputText value="#{marcadoresBackingBean.descricao}" /><br />
                    <b>Data: </b><h:outputText value="#{marcadoresBackingBean.data}" />
                </div>
            </h:panelGroup>
        </h:form> 
        <div class="frameContent">
            <h3>Adicionar novo marcador:</h3>
            <div id="container">
                <div class="framecenter" style="width: 400px;">
                    <h:form id="contractform" styleClass="formS">
                        <div id="focus">
                            <fieldset>
                                <div class="fm-opt">
                                    <label><h:outputText value="Contrato"/></label>
                                    <h:selectOneMenu id="supplierCombo" value="#{marcadoresBackingBean.selectedContract}" title="Seleccione um contrato para adicionar um novo marcador.">
                                        <f:selectItems value="#{marcadoresBackingBean.contractList}" />
                                    </h:selectOneMenu>
                                </div>
                                <div class="fm-opt">
                                    <label><h:outputText value="Descrição"/></label>
                                    <h:inputText id="descricao" value="#{marcadoresBackingBean.nomeNovo}" title="Escreva uma breve descrição sobre o marcador" />
                                </div>
                                <div class="fm-opt">
                                    <label><h:outputText value="Data"/></label>
                                    <h:inputText id="inputDate" styleClass="inputDate" value="#{marcadoresBackingBean.hoje}"></h:inputText>
                                </div>
                            </fieldset>
                        </div>
                        <div id="fm-submit">
                            <h:commandButton id="SubmitButton" value="Submeter" action="#{marcadoresBackingBean.submit()}" title="Clique para adicionar" />
                        </div>
                    </h:form>
                </div>
            </div>
        </div>

        <sg:pageFooter />
        <script>
            var state = false;
            var cenas = function() {
                $('#framecenter').animate({height: state ? 0 : 300 }, 500);
            } 
        </script>

        <script>$('#contractform\\:inputDate').DatePicker({
        format:'d/m/Y',
        date: $('#contractform\\:inputDate').val(),
        current: $('#contractform\\:inputDate').val(),
        starts: 1,
        position: 'r',
        onBeforeShow: function(){
                $('#contractform\\:inputDate').DatePickerSetDate($('#contractform\\:inputDate').val(), true);
        },
        onChange: function(formated, dates){
                $('#contractform\\:inputDate').val(formated);
        }
});</script>
    </h:body>
</html>

